$(function(){
 function loginsubmit(){
                var money=true;
               
var form=$('#theForm').serialize();

                if($('#theForm input[name=money]').val() == ''){
                   // $('#error').html('<span class="error">!</span>');
					msg('金额不能为空');
                    $('#theForm input[name=money]').focus();
                    money = false;
                    return false;
                }
 
	       if($('#theForm input[name=paypwd]').val() == ''){
                   // $('#error').html('<span class="error">!</span>');
					msg('交易密码不能为空！');
                    $('#theForm input[name=paypwd]').focus();
                    money = false;
                    return false;
                }
               
				
               

                if( $('#theForm input[name=money]').val() != '' ){
                    $.ajax({
                        async:false,
                        url:"/index/user/usertx",
                        data:form,
                        type:'post',
                        dataType:'json',
                        success:function(res){
							console.log(res);
                            if(res.status != 1){
                              
								msg(res.msg);
                               
                                money=false;
                                paytype=false;
                                return false;
                            }else{
								 msg(res.msg);
                             setTimeout(function(){window.location.reload();},2000);
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							
							msg('网络失败，请刷新页面后重试!');
                          
                        }
                    });
                }else{
                    return false;
                }
            }

           
            $('#button').on('click',function(){
				
                loginsubmit();
            });
			
			
           
			
        });